<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <link rel="shortcut icon" href="./img/favicon.ico" />
    <title>test nginx</title>
</head>

<body>
    <div id="app">
        test nginx
        <input type="file" id="test">
    </div>
    <!-- built files will be auto injected -->
</body>
<script src="./vendor/jquery.min.js"></script>
<script>
    window.onload = function () {
        document.querySelector('#test').addEventListener('change', function (e) {
            var file = e.target.files[0];
            var formData = new FormData();
            formData.append('file', file);
            $.ajax({
                url: 'http://127.0.0.1:80/upload',
                type: 'POST',
                data: formData,
                dataType: 'JSON',
                cache: false,
                processData: false,
                contentType: false,
                success: function (data) {
                    console.log(data);
                },
                error: function () {
                    console.log('error');
                }
            });
        })
    }
</script>

</html>